module.exports = function getIPAdress(){
    var interfaces = require('os').networkInterfaces();
    var obj = {ip:'',name:require("os").hostname()};
    for(var devName in interfaces){
        var iface = interfaces[devName];
        for(var i=0;i<iface.length;i++){
            var alias = iface[i];
            if(alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal){
                var ip = alias.address;
                if(alias.address.indexOf('http') == -1){
                    ip = 'http://'+ alias.address;
                };
                obj.ip =  ip;
                break;
            }
        }
    }
    return obj;
}